home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / ogle.com / OGLE.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1989-09-10  |  2.6 KB  |  86 lines

  1.  
  2. {a program to show the three possible eye styles on the screen}
  3. {Written by Michael Day as of 4 September 1989}
  4. {released to the public domain by the author}
  5. {10 Sept 89 - Fixed Herc Graphics mode mouse}
  6.  
  7. program Ogle;
  8. uses crt,graph,mouse,eyes;
  9.  
  10. var SysClock : word absolute $40:$6C;
  11.     EyeData : array[0..10] of EyeDataRec;
  12.     EyeSize : integer;
  13.     MaxEye : integer;
  14.  
  15.     i,gr,gd:integer;
  16.     OldClock:word;
  17.  
  18. begin
  19.    gd := 0;  gr := 0;    {start up the graphics}
  20.    InitGraph(gd,gr,'');
  21.    i := GraphResult;
  22.    if GraphResult <> GrOK then
  23.    begin
  24.      Writeln('GraphError:',GrOK);
  25.      Halt(1);
  26.    end;
  27.  
  28.    if gd = HercMono then  {if Herc, enable herc mouse}
  29.      SetHercMouse(0);
  30.  
  31.    MaxEye := 2;          {init the eyes}
  32.    EyeSize := 10;
  33.  
  34.    if (gd = EGA) or (gd = VGA) then
  35.    begin
  36.      SetFillStyle(CloseDotFill,blue);  {init the screen}
  37.      Bar(0,0,GetMaxX,GetMaxY);
  38.      MakeEyes(EyeData[0],(GetMaxX div 3),GetMaxY div 3,
  39.                EyeSize,2,white,brown,lightblue);
  40.      MakeEyes(EyeData[1],((GetMaxX div 3)*2),GetMaxY div 3,
  41.                EyeSize*2,1,black,white,yellow);
  42.      MakeEyes(EyeData[2],(GetMaxX div 2),(GetMaxY div 3)*2,
  43.                EyeSize*3,0,red,green,black);
  44.    end
  45.    else
  46.    begin
  47.      SetFillStyle(CloseDotFill,white);  {init the screen}
  48.      Bar(0,0,GetMaxX,GetMaxY);
  49.      MakeEyes(EyeData[0],(GetMaxX div 3),GetMaxY div 3,
  50.                EyeSize,2,white,black,black);
  51.      MakeEyes(EyeData[1],((GetMaxX div 3)*2),GetMaxY div 3,
  52.                EyeSize*2,1,black,white,white);
  53.      MakeEyes(EyeData[2],(GetMaxX div 2),(GetMaxY div 3)*2,
  54.                EyeSize*3,0,black,white,white);
  55.    end;
  56.  
  57.    
  58.    setcolor(white);           {show which eyes are which}
  59.    Outtextxy(EyeData[0].Lecx-EyeData[0].Exr,
  60.               EyeData[0].Lecy+EyeData[0].Eyr+4,' Log2');
  61.    Outtextxy(EyeData[1].Lecx-EyeData[1].Exr,
  62.               EyeData[1].Lecy+EyeData[1].Eyr+4,'   Scaled');
  63.    Outtextxy(EyeData[2].Lecx,
  64.               EyeData[2].Lecy+EyeData[2].Eyr+4,'  Clipped');
  65.  
  66.    InitMouse;                           {startup the mouse}
  67.    ShowMouse;
  68.    i := 0;
  69.    while not keypressed do              {Do it until a key is pressed}
  70.    begin
  71.      if (OldClock <> SysClock) then     {only update on clock change}
  72.      begin                              {this minimizes flicker}
  73.        ReadMouse;
  74.        OldClock := SysClock;
  75.        LookAt(EyeData[i],GetMx(MouseX),GetMy(MouseY)); {update the eyes}
  76.        inc(i);
  77.        if i > MaxEye then i := 0;       {rotate through all the eyes}
  78.      end;
  79.    end;
  80.    HideMouse;
  81.    CloseGraph;   {all done, go home}
  82. end.
  83.  
  84.  
  85.  
  86.